import { Component } from '@angular/core';
import { NavController, NavParams, IonicPage } from 'ionic-angular';
import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';

@IonicPage()
@Component({
  selector: 'page-card-image',
  templateUrl: 'card-image.html'
})
export class CardImagePage {
  card =
    {
      imageUrl: 'assets/imgs/card/0.png',
      title: 'Nine Inch Nails Live',
      description: 'The most popular industrial group ever, and largely responsible for bringing the music to a mass audience.'
    };

  constructor(public navCtrl: NavController,
              public navParams: NavParams, private nativePageTransitions: NativePageTransitions) { 
      this.card.imageUrl = navParams.get("imageUrl");
      this.card.title = navParams.get("title");
      this.card.description = navParams.get("description");

  }

  cardTapped(card) {
    alert(card.title + ' was tapped.');
  }

  share(card) {
    alert(card.title + ' was shared.');
  }

  listen(card) {
    alert('Listening to ' + card.title);
  }

  favorite(card) {
    alert(card.title + ' was favorited.');
  }


  ionViewWillLeave() {

   let options: NativeTransitionOptions = {
      direction: 'right',
      duration: 400,
      slowdownfactor: -1,
      iosdelay: 50
     };

   this.nativePageTransitions.slide(options)
     .then(function(){})
     .catch(function(){});

  }


}
